#include "pch.h"
#include<iostream>

using namespace std;


class Solution {
public:
	bool hasAlternatingBits(int n) {
		int m = n%2;
		n = n / 2;
		while (n)
		{
			if (m == n % 2) 
			{
				return false;
			}
			m = n % 2;
			n = n / 2;
		}
		return true;
	}
};

//int main()
//{
//	Solution *s = new Solution;
//	cout<<s->hasAlternatingBits(5);
//	return 0;
//}